package com.itqf.controller;

import com.itqf.entity.TbItem;
import com.itqf.service.TbItemService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Description:
 * @Company: 千锋互联
 * @Author: 李丽婷
 * @Date: 2020/12/23
 * @Time: 上午11:01
 */
@RestController
public class MyController {

    @Resource
    private TbItemService tbItemService;


    @RequestMapping("/findById/{id}")
    public TbItem  findById(@PathVariable("id") int id){

        System.out.println(tbItemService.findById(id));//1
        System.out.println(tbItemService.findById(id));//缓存

        tbItemService.clearfindById(id);

        System.out.println(tbItemService.findById(id));//1
        System.out.println(tbItemService.findById(id));//缓存

        System.out.println(tbItemService.findById(10));//1

        return  tbItemService.findById(id);//缓存

    }

    @RequestMapping("/find")
    public  TbItem find(){

        return  tbItemService.find();
    }





}
